package com.caseProject.puremvc.facade
{
	import com.caseProject.puremvc.command.ActionsGraphicCommand;
	import com.caseProject.puremvc.command.CloseProjectCommand;
	import com.caseProject.puremvc.command.NewDiagramCommand;
	import com.caseProject.puremvc.command.NewProjectCommand;
	import com.caseProject.puremvc.command.OpenDiagramCommand;
	import com.caseProject.puremvc.command.OpenProjectCommand;
	import com.caseProject.puremvc.command.RemoveDiagramCommand;
	import com.caseProject.puremvc.command.SaveProjectCommand;
	import com.caseProject.puremvc.command.StartupCommand;
	import com.caseProject.puremvc.notifications.NotificationNames;
	
	import org.puremvc.as3.patterns.facade.Facade;
	
	public class CaseFacade extends Facade
	{
		private static var instance:CaseFacade;
		
		public static function getInstance():CaseFacade
		{
			if (instance == null)
			{
				instance = new CaseFacade();
			}
			return instance as CaseFacade;
		}
		
		/**
		 * Registra os commands iniciais
		 * */
		override protected function initializeController():void
		{
			super.initializeController();
			
			this.registerCommand(NotificationNames.STARTUP, StartupCommand);
			
			this.registerCommand(NotificationNames.PROJECT_MENU_NOVO_PROJETO, NewProjectCommand);
			this.registerCommand(NotificationNames.PROJECT_MENU_SALVAR, SaveProjectCommand);
			this.registerCommand(NotificationNames.PROJECT_MENU_ABRIR, OpenProjectCommand);
			this.registerCommand(NotificationNames.PROJECT_MENU_FECHAR, CloseProjectCommand);
			this.registerCommand(NotificationNames.NEW_DIAGRAM_ACTIVITY, NewDiagramCommand);
			this.registerCommand(NotificationNames.NEW_DIAGRAM_STATE, NewDiagramCommand);
			this.registerCommand(NotificationNames.MENU_LIST_OPEN_DIAGRAM, OpenDiagramCommand);
			this.registerCommand(NotificationNames.REMOVE_DIAGRAM, RemoveDiagramCommand);
			this.registerCommand(NotificationNames.GRAPHIC_DELETE_ELEMENT, ActionsGraphicCommand);
			this.registerCommand(NotificationNames.GRAPHIC_DELETE_PARTITION, ActionsGraphicCommand);
			this.registerCommand(NotificationNames.GRAPHIC_DELETE_TRANSITION, ActionsGraphicCommand);
			this.registerCommand(NotificationNames.RETRIEVE_LINKED_TRANSITIONS, ActionsGraphicCommand);
		}
		
		public function startup(app:Object):void
		{
			this.sendNotification(NotificationNames.STARTUP, app);
		}
	}
}